
/****** Object:  StoredProcedure [usp_GetInatallersMasterByID]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_GetInatallersMasterByID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_GetInatallersMasterByID];
GO

CREATE PROCEDURE [usp_GetInatallersMasterByID]
(
	@InstallerID int
)
AS
BEGIN
	SET NOCOUNT ON
	DECLARE @Err int

	SELECT
		[InstallerID],
		[InstallerName],
		[Address],
		[PhoneNo],
		[MobileNo],
		[LastModifiedUser],
		[LastModifiedDateTime]
	FROM [InatallersMaster]
	WHERE
		([InstallerID] = @InstallerID)

	SET @Err = @@Error

	RETURN @Err
END
GO


/****** Object:  StoredProcedure [usp_GetAllInatallersMaster]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_GetAllInatallersMaster]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_GetAllInatallersMaster];
GO

CREATE PROCEDURE [usp_GetAllInatallersMaster]
AS
BEGIN

	SET NOCOUNT ON
	DECLARE @Err int

	SELECT
		[InstallerID],
		[InstallerName],
		[Address],
		[PhoneNo],
		[MobileNo],
		[LastModifiedUser],
		[LastModifiedDateTime]
	FROM [InatallersMaster]

	SET @Err = @@Error

	RETURN @Err
END
GO


/****** Object:  StoredProcedure [usp_UpdateInatallersMaster]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_UpdateInatallersMaster]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_UpdateInatallersMaster];
GO

CREATE PROCEDURE [usp_UpdateInatallersMaster]
(
	@InstallerID int,
	@InstallerName varchar(50),
	@Address varchar(MAX),
	@PhoneNo varchar(20) = NULL,
	@MobileNo varchar(10),
	@LastModifiedUser int,
	@LastModifiedDateTime datetime
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	UPDATE [InatallersMaster]
	SET
		[InstallerName] = @InstallerName,
		[Address] = @Address,
		[PhoneNo] = @PhoneNo,
		[MobileNo] = @MobileNo,
		[LastModifiedUser] = @LastModifiedUser,
		[LastModifiedDateTime] = @LastModifiedDateTime
	WHERE
		[InstallerID] = @InstallerID


	SET @Err = @@Error


	RETURN @Err
END
GO




/****** Object:  StoredProcedure [usp_InsertInatallersMaster]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_InsertInatallersMaster]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_InsertInatallersMaster];
GO

CREATE PROCEDURE [usp_InsertInatallersMaster]
(
	@InstallerID int = NULL output,
	@InstallerName varchar(50),
	@Address varchar(MAX),
	@PhoneNo varchar(20) = NULL,
	@MobileNo varchar(10),
	@LastModifiedUser int,
	@LastModifiedDateTime datetime
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	INSERT
	INTO [InatallersMaster]
	(
		[InstallerName],
		[Address],
		[PhoneNo],
		[MobileNo],
		[LastModifiedUser],
		[LastModifiedDateTime]
	)
	VALUES
	(
		@InstallerName,
		@Address,
		@PhoneNo,
		@MobileNo,
		@LastModifiedUser,
		@LastModifiedDateTime
	)

	SET @Err = @@Error

	SELECT @InstallerID = SCOPE_IDENTITY()

	RETURN @Err
END
GO


/****** Object:  StoredProcedure [usp_DeleteInatallersMaster]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_DeleteInatallersMaster]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_DeleteInatallersMaster];
GO

CREATE PROCEDURE [usp_DeleteInatallersMaster]
(
	@InstallerID int
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	DELETE
	FROM [InatallersMaster]
	WHERE
		[InstallerID] = @InstallerID
	SET @Err = @@Error

	RETURN @Err
END
GO

